import pandas as pd
from sklearn.preprocessing import LabelBinarizer

df = pd.read_csv("D:\数据挖掘\数据预处理-两次实验\数据预处理-实验1\house_train.csv", usecols=['floor'])
# 创建df文件的副本
df1 = df.copy()

# 创建一个LabelBinarizer对象
label_binarizer = LabelBinarizer()

# 拟合floor列到LabelBinarizer
label_binarizer_output = label_binarizer.fit_transform(df1['floor'])

# 使用DataFrame
result_df = pd.DataFrame(label_binarizer_output,
                         columns=label_binarizer.classes_)

# result_df=LabelBinarizer().fit_transform(df['floor'])
print(result_df.to_string())